package com.mianyang.zhangsan.common.base;

import java.util.Map;

/**
 * @author jiangjr
 * @date 2022-10-23
 */
public class BaseController {

    public R success(String key, Object value) {
        R r = new R(200, "操作成功");
        r.put(key, value);
        return r;
    }

    public R success(Map<String, Object> data) {
        return new R(200, "操作成功", data);
    }

    public R success() {
        return new R(200, "操作成功", null);
    }

    public R fail(String key, Object value) {
        R r = new R(500, "操作失败");
        r.put(key, value);
        return r;
    }

    public R fail(String message) {
        return new R(500, message, null);
    }
}
